<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
include("kn.php");
$lenh = "select tenlaptop,tenhanglaptop,tenloai,soluong,dongia,hinh,ngaynhap,left(mota,15) as mota,malaptop from laptop,hanglaptop,loailaptop where laptop.mahanglaptop = hanglaptop.mahanglaptop and laptop.maloailaptop = loailaptop.maloailaptop";
$kq = mysql_query($lenh);
$sodulieu = mysql_num_rows($kq);
$sodong = 5;
$sotrang = ceil($sodulieu/$sodong);
if(!$_GET["p"])
$p = 1;
else
$p = $_GET["p"];
//tìm vị trí đầu mỗi trang
$x = ($p -1)*$sodong;
$lenh1 = "select left(tenlaptop,15)as tenlaptop,tenhanglaptop,tenloai,soluong,dongia,hinh,ngaynhap,left(mota,15) as mota,malaptop from laptop,hanglaptop,loailaptop where laptop.mahanglaptop = hanglaptop.mahanglaptop and laptop.maloailaptop = loailaptop.maloailaptop limit $x,$sodong";
$kq1 = mysql_query($lenh1);


echo"<table width='550' border='1' align='center' cellpadding='0' cellspacing='0' bordercolor='#FFCCCC' bgcolor='#FFFFCC' style='border-collapse:collapse'>
  <tr>
    <td height='35' colspan='11' align='center' bgcolor='#FFFF99'><strong>THÔNG TIN LAPTOP</strong></td>
  </tr>
  <tr>
    <td align='center'>STT</td>
    <td align='center'>Tên laptop</td>
    <td align='center'>Nhà sản xuất</td>
    <td align='center'>Loại laptop</td>
    <td align='center'>Số lượng</td>
    <td align='center'>Đơn giá</td>
    <td align='center'>Hình </td>
    <td align='center'>Ngày nhập</td>
	<td align='center'>Nội dung</td>
	<td align='center'>Sửa</td>
	<td align='center'>Xóa</td>
	
  </tr>";
  $stt = $x+1;
  while($row = mysql_fetch_row($kq1))
  {
  echo"<tr>
    <td align='center'>$stt</td>
    <td>$row[0]</td>
    <td>$row[1]</td>
    <td>$row[2]</td>
    <td>$row[3]</td>
    <td>$row[4]</td>
    <td><img src='laptop/$row[5]' width= '30' heigh='30' /></td>
     <td>$row[6]</td>
	 <td>$row[7]</td>
	  <td><a href='index.php?idsua=$row[8]'>Sửa</a></td>
	  <td><a href='index.php?idxoa=$row[8]'>Xóa</a></td>
	 
  </tr>";
  $stt ++;
  }
echo"</table>";
?>

<p align="center">
<?php
for($i = 1; $i <= $sotrang; $i++)
{
	if($i == $p)
	{
		echo $i."&nbsp;";
	}
	else
	{
	?>
	<a href="index.php?act=cn&p=<?php echo $i;?>"><?php echo $i;?></a>
	<?php
	}


}


?>
</p>
</body>
</html>
